import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    port: 8080,
    proxy: {
      '/api': {
        target: 'https://api.mch.weixin.qq.com',
        changeOrigin: true,
        // 关键修改：移除路径中的/api前缀，避免重复
        rewrite: (path) => path.replace(/^\/api/, ''),
        headers: {
          'Referer': 'http://192.168.31.79:8080'
        }
      }
    }
  }
})